<template>
  <el-config-provider :locale="locale"> <router-view /> </el-config-provider>
</template>

<script lang="ts">
import store from '@/store/index'
import { computed, defineComponent, onMounted } from 'vue'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import en from 'element-plus/es/locale/lang/en'
export default defineComponent({
  setup () {
    const locale = computed(() => {
      return store.state.config.locale === 'zhCn' ? zhCn : en
    })
    onMounted(() => {
      const html = document.getElementsByTagName('html')[0]
      html.setAttribute('class', store.state.config.theme)
    })
    return {
      locale
    }
  }
})
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: var(--textColor);
}
</style>
